<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link href="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/dist/css/bootstrap.min.css"
          rel="stylesheet">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css"/>
    <title>基于 jQuery 的 Ajax 请求</title>
</head>
<body>
<button id="btn" type="button">jQuery Ajax 请求按钮</button>
<div id="msg" style="color: red"></div>
<script src="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/assets/js/vendor/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/dist/js/bootstrap.min.js"></script>
<script type="text/javascript">
    $(function () {
        $('#btn').click(function () {
            $.ajax({
                url: './ajax02.do',
                data: {param1: 'value1', param2: "value2"},
                type: 'GET',
                success: function (data) {
                    //在 function 中添加的 data 参数，代表服务器在响应成功时 回传的数据
                    console.log(data);
                    $('#msg').text(data);
                }
            });
        });
    });
</script>
</body>
</html>